<?php


namespace app\api\controller;


use think\facade\Request;

class Common
{
    public function __construct()
    {
    }


    /**
     * dexonzh外包加密方式
     */
    public function dexonApiEncryption($msg){
        $datas = array();
        $datas['didtype']="web";
        $datas['version']=config('app.version');
        $datas['msg']=$msg;
        $datas['time']=time();
        $datas['appstart']=config('app.appstart');
        $datas['append']=config('app.append');
        ksort($datas);
        $data=json_encode($datas,JSON_UNESCAPED_UNICODE);
        return (new Aes())->encrypt($data);
    }

    /**
     * dexonzh外包解密方式
     * @param $str
     * @return mixed
     */
    public function dexonApiDecrypt($str){
        $data  = (new Aes())->decrypt($str);
        $sign =(array)json_decode($data);
        return $sign;
    }
}